<?php

namespace App\Library\Requests\Product;

use App\Library\Requests\Base\BasePageRequest;

class ProductPageRequest extends BasePageRequest
{
    public function rules(): array
    {
        return array_merge(parent::rules(), [
            'status' => 'nullable|integer|between:0, 3',
            'keyword' => 'nullable|string|max:255',
            'startAt' => 'nullable|date|date-format:Y-m-d',
            'endAt' => 'nullable|required_with:startAt|after_or_equal:startAt|date|date-format:Y-m-d',
            'orderBy' => 'nullable|in:asc,desc',
            'buyWillStatus' => 'required_if:status, 3|boolean'
        ]);
    }
}
